function calcPageHeight(doc) {
    var cHeight = Math.max(doc.body.clientHeight, doc.documentElement.clientHeight);
    var sHeight = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight);
    var height  = Math.max(cHeight, sHeight);
    return height;
}

function getDocumentHeight(baseurl) {
    var doc = document;
    var iframe = document.createElement("iframe");
    var height = calcPageHeight(doc);
    var url = baseurl + "/application/newversion/autoheight"+ "?height=" + height;
        iframe.scrolling="no";
        iframe.style.width = "100%";
        iframe.style.border = "none";
        iframe.style.display = "none";
        iframe.src = url;
        document.getElementsByTagName("body")[0].appendChild(iframe);
}